//
//  TyrntTableViewCell.m
//  Tongcheng
//
//  Created by   丛熠超 on 2017/4/6.
//  Copyright © 2017年 Tongcheng. All rights reserved.
//

#import "TyrntTableViewCell.h"
#import "UIImageView+AFNetworking.h"

@interface TyrntTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *GoldImageView;
@property (weak, nonatomic) IBOutlet UILabel *goldLabel;

@property (weak, nonatomic) IBOutlet UIImageView *IconImageView;
@property (weak, nonatomic) IBOutlet UILabel *NameLB;
@property (weak, nonatomic) IBOutlet UILabel *AgeLB;
@property (weak, nonatomic) IBOutlet UILabel *DistantLb;
@property (weak, nonatomic) IBOutlet UILabel *GiftNumLB;

@end

@implementation TyrntTableViewCell

- (void)setModel:(TuhaoListModel *)model
{
    _model = model;
    [self.IconImageView setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:nil];
    self.NameLB.text = model.user_nicename;
    if ([model.sex isEqualToString:@"1"]) {
        self.AgeLB.text = [NSString stringWithFormat:@"♂%@", model.age];
    }else{
        self.AgeLB.text = [NSString stringWithFormat:@"♀%@", model.age];
//        self.AgeLB.backgroundColor = RGB(0xFDA5A3);
    }
    self.DistantLb.text = [NSString stringWithFormat:@"%ldkm", model.km];
    self.GiftNumLB.text = [NSString stringWithFormat:@"送出:%@个礼物", model.amount];
    if (model.rank == 1) {
        self.GoldImageView.image = [UIImage imageNamed:@"金牌"];
        self.goldLabel.text = nil;
    }else if (model.rank == 2){
        self.GoldImageView.image = [UIImage imageNamed:@"金牌"];
        self.goldLabel.text = nil;
    }else if (model.rank == 3){
        self.GoldImageView.image = [UIImage imageNamed:@"金牌"];
        self.goldLabel.text = nil;
    }else{
        self.GoldImageView.image = nil;
        self.goldLabel.text = [NSString stringWithFormat:@"%ld", model.rank];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
